<%@page import="domain.model.Emails"%>
<%@page import="java.util.Date"%>
<%@page import="domain.service.Utils"%>
<%@page import="domain.model.InOutLink"%>
<%@page import="java.text.NumberFormat"%>
<%@page import="domain.model.Domain"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Collections"%>
<%@page import="javax.cache.CacheException"%>
<%@page import="javax.cache.CacheManager"%>
<%@page import="javax.cache.Cache"%>
<%@page import="domain.model.Whois"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html;charset=UTF-8" language="java"%>
<% request.setCharacterEncoding("utf-8");%>
<%
String title = (String) request.getAttribute("title");
String description = (String) request.getAttribute("description");
String keywords = (String) request.getAttribute("keyword");
Domain domain = (Domain) request.getAttribute("domain");
NumberFormat nf = NumberFormat.getInstance();
List<InOutLink> inlink = (List<InOutLink>) request.getAttribute("inlink");
List<InOutLink> outlink = (List<InOutLink>) request.getAttribute("outlink");
List<Whois> whois = (List<Whois>) request.getAttribute("whois");
List<Domain> otherDomain = (List<Domain>) request.getAttribute("otherDomain");
List<Emails> mails = (List<Emails>) request.getAttribute("emails");

Date date = new Date();
Date dates = new Date();
if(domain.getLastUpdateDate() != null)
{
	dates = domain.getLastUpdateDate();
}
long seconds = (date.getTime() - dates.getTime())/1000;
long day = (int) (seconds / 86400);
long hour = (int) ((seconds - day*86400) / 3600);
long minute = (int) ((seconds - day*86400 - hour*3600) / 60);

%>
<jsp:include page="layout/header.jsp">
	<jsp:param name="title" value="<%=title %>"/>
	<jsp:param name="description" value="<%=description %>"/>
	<jsp:param name="keywords" value="<%=keywords %>"/>
</jsp:include>
		<div class="bd al pd">
			<%@ include file='/adv/banner.jsp'%><br/><br/>
			<h1 class="td">
				<%=domain.getName() %>
				<%
				if(day>=0 || domain.getLastUpdateDate() == null)
				{
				%>
							( <a href="javascript:void(0)" rel="nofollow" id="update">Update</a> )
				<%
				}
				%>
			</h1>
			Updated<b>
			<%
				if(day > 0)
				{
					out.print(day+" days, ");
				}
				if(hour > 0)
				{
					out.print(hour+" hours, ");
				}
				out.print(minute+" minutes");
			%>	</b> Ago<br/><br/>
			<%@ include file='/adv/note.jsp'%>
			<p class="des">
				<strong><%=domain.getName() %></strong> has pagerank is <strong><%=domain.getRankGoogle() %></strong>, alexa rank is <strong><%=(domain.getRankAlexa() != 0)?nf.format(domain.getRankAlexa()):"-" %></strong>, 
				the domain is <strong><%=Utils.checkLengthDomain(domain.getName()) %></strong> characters in length, <strong><%=domain.getName() %></strong> use web server: <strong><%=(domain.getWebserver()!=null)?domain.getWebserver():"-" %></strong>, 
				use language <strong><%=(domain.getProgramingLanguage()!=null)?domain.getProgramingLanguage():"-" %></strong>, the average speed of the site is <strong><%=(domain.getSpeed()!=null)?domain.getSpeed():'-' %> </strong>, 
				the average amount of visitors is <strong><%=(domain.getVisit()!=null && !domain.getVisit().equals("-"))?nf.format(Math.ceil(((350*Float.parseFloat(domain.getVisit()))*80)/0.03))+" - "+nf.format(Math.ceil(((350*Float.parseFloat(domain.getVisit()))*120)/0.03)):"-" %> </strong>.
			</p>
			<div class="dl">
				<ul>
					<li>
						<div class="bl">Domain</div>
						<div class="br">
							<%
							if(domain.getName()!=null)
							{
							%>
								<strong>
									<%=domain.getName() %>&nbsp;&nbsp;&nbsp;  <% if(domain.getSex() != 1){ %><a href="http://<%=domain.getName()%>" target="_blank" rel="nofollow">Visit site</a><% } %>
									<% if(domain.getShowsite() == 1){ %> | View <a href="http://www.showsiteinfo.appspot.com/sites/<%=domain.getName()%>" target="_blank"> <%=domain.getName()%> </a> in showsiteinfo<% } %>
								</strong>
								<br/><strong>Length : <%=Utils.checkLengthDomain(domain.getName()) %></strong>
								characters
							<%
							} else {
								out.println(domain.getName());
							}
							%>
						</div>
					</li>
					<%
					if(otherDomain.size()>0)
					{
					%>
					<li>
						<div class="bl">Other Domain</div>
						<div class="br">
							<%
								for(int i=0;i<otherDomain.size();i++)
								{
									out.println("<a href='/domain/"+otherDomain.get(i).getName()+"'>"+otherDomain.get(i).getName()+"</a>");
									if(i!=(otherDomain.size()-1))
										out.println(" , ");
								}
							%>
						</div>
					</li>
					<%
					}
					%>
					<li>
						<div class="bl">Title</div>
						<div class="br">
							<%
							if(domain.getTitle()!=null && domain.getSex() != 1)
							{
							%>
								<%=domain.getTitle() %>
								<br/><strong>Length : <%=domain.getTitle().length() %></strong>
								characters
							<%
							} else {
								out.println(domain.getName());
							}
							%>
						</div>
					</li>
					<li>
						<div class="bl">Keywords</div>
						<div class="br">
							<%
							if(domain.getSex() != 1)
							{
							%>
								<%=domain.getKeywordString().replaceAll("[ ]+[,]+[ ]+$","") %>
								<br/><strong>Length : <%=domain.getKeywordString().replaceAll("[ ]+[,]+[ ]+$","").replaceAll("\\<.*?\\>", "").length() %></strong>
								characters
								<br/><strong>Numbers : <%=domain.getKeywords().size() %></strong>
								keywords
							<%
							}
							%>
						</div>
					</li>
					<li>
						<div class="bl">Popular Keywords</div>
						<div class="br">
							<%
							if(domain.getSex() != 1)
							{
							%>
							<%=domain.getPopularKeywordString().replaceAll("[ ]+[,]+[ ]+$","") %>
							<%
							}
							%>
						</div>
					</li>
					<li>
						<div class="bl">Description</div>
						<div class="br">
							<%
							if(domain.getDescription() != null && domain.getSex() != 1)
							{
							%>
								<%=domain.getDescription().getValue() %>
								<br/><strong>Length : <%=domain.getDescription().getValue().length() %></strong>
								characters
							<%
							} else {
								out.println("No description");
							}
							%>
						</div>
					</li>
					<li>
						<div class="bl">
							Whois: <% if(whois.size() >0)out.println("<a href='/whois/"+domain.getName()+"'>( More detail... )</a>"); %>
						</div>
						<div class="br ws">
							<%
								if(whois.size() > 0)
								{
									out.println(whois.get(0).getWhois().getValue());
								} else {
									out.println("<a href='/whois/"+domain.getName()+"'>Update whois</a>");
								}
							%>
						</div>
					</li>
					<%
					if(outlink.size() > 0)
					{
					%>
						<li>
							<div class="bl">Out link: <a href="/link-out/<%=domain.getName()%>">View all</a></div>
							<div class="br">
								<ul class="ll">
									<%
									for(int i=0;i<outlink.size();i++)
									{
									%>
										<li>
											<a href="http://<%=outlink.get(i).getOutLink() %>" target="_blank" rel="nofollow" class="l">http://<%=outlink.get(i).getOutLink() %></a>
											<a href="/domain/<%=outlink.get(i).getOutLink() %>" class="r">View infomation</a>
											<div class="cl"></div>
										</li>
									<%
									}
									%>
								</ul>
							</div>
						</li>
					<%
					}
					%>
					<%
					if(inlink.size() > 0)
					{
					%>
						<li>
							<div class="bl">In link: <a href="/link-in/<%=domain.getName()%>">View all</a></div>
							<div class="br">
								<ul class="ll">
									<%
									for(int i=0;i<inlink.size();i++)
									{
									%>
										<li>
											<a href="http://<%=inlink.get(i).getInLink() %>" target="_blank" rel="nofollow" class="l">http://<%=inlink.get(i).getInLink() %></a>
											<a href="/domain/<%=inlink.get(i).getInLink() %>" class="r">View infomation</a>
											<div class="cl"></div>
										</li>
									<%
									}
									%>
								</ul>
							</div>
						</li>
					<%
					}
					%>
				</ul>
				<div>
					<div class="dly l">Daily Rank</div>
					<div class="dly r">Daily PageViews</div>
					<img src="http://traffic.alexa.com/graph?c=1&amp;u=<%=domain.getName() %>&amp;r=6m&amp;y=t&amp;z=3&amp;h=200&amp;w=280&amp;b=FFFFFF" class="l"/>
					<img src="http://traffic.alexa.com/graph?c=1&amp;u=<%=domain.getName() %>&amp;r=6m&amp;y=r&amp;z=3&amp;h=200&amp;w=280&amp;b=FFFFFF" class="r"/>
					<div class="cl"></div>
				</div>
				<div class="ti">Site's same email</div>
				<ul class="detail">
					<li>
						<div class="bl">
							<%=(whois.size()>0&&whois.get(0).getEmail()!=null&& domain.getSex() != 1)?whois.get(0).getEmailString():"-" %>
						</div>
						<div class="br">
							<%
							ArrayList<String> list = new ArrayList<String> ();
							if(mails!=null && mails.size()>0)
							{
								for(int i=0;i<mails.size();i++)
								{
									if(!list.contains(mails.get(i).getDomain()))
									{
										list.add(mails.get(i).getDomain());
							%>
									<a href="/domain/<%=mails.get(i).getDomain()%>"><%=mails.get(i).getDomain()%></a> <%=(i!=(mails.size()-1))?" , ":"" %> 
							<%
									}
								}
							}
							%>
						</div>
					</li>
				</ul>
				<div class="ti">Other sites hosted on</div>
				<ul class="detail">
					<%=(request.getAttribute("sameip") != null && !request.getAttribute("sameip").equals(""))?request.getAttribute("sameip"):"Unknown" %>
				</ul>
				
				<%@ include file='/element/de_random.jsp'%>
				<%@ include file='/element/de_new.jsp'%>
				<jsp:include page="/element/de_top_site.jsp">
					<jsp:param name="title1" value="1"/>
				</jsp:include>
			</div>
			<div class="dr">
				<ul>
					<li>
						<div class="wrl">Google PR : </div>
						<div class="wrr"><%=domain.getRankGoogle() %></div>
						<div class="cl"></div>
					</li>
					<li>
						<div class="wrl">Alexa rank : </div>
						<div class="wrr"><%=(domain.getRankAlexa() != 0)?nf.format(domain.getRankAlexa()):"-" %></div>
						<div class="cl"></div>
					</li>
					
					<li>
						<div class="wrl">Visit : </div>
						<div class="wrr"><%=(domain.getVisit()!=null && !domain.getVisit().equals("-"))?nf.format(Math.ceil(((350*Float.parseFloat(domain.getVisit()))*80)/0.03))+" - "+nf.format(Math.ceil(((350*Float.parseFloat(domain.getVisit()))*120)/0.03)):"-" %></div>
						<div class="cl"></div>
					</li>
					<li>
						<div class="wrl">Speed site : </div>
						<div class="wrr"><%=(domain.getSpeed()!=null)?domain.getSpeed():'-' %></div>
						<div class="cl"></div>
					</li>
					<li>
						<div class="wrl">Domain Age : </div>
						<div class="wrr"><%=(domain.getDomainAge()!=null)?domain.getDomainAge():"-" %></div>
						<div class="cl"></div>
					</li>
					<li>
						<div class="wrl">Charset : </div>
						<div class="wrr"><%=(domain.getCharset()!=null)?domain.getCharset():"-" %></div>
						<div class="cl"></div>
					</li>
					<li>
						<div class="wrl">Language : </div>
						<div class="wrr"><%=(domain.getProgramingLanguage()!=null)?domain.getProgramingLanguage():"-" %></div>
						<div class="cl"></div>
					</li>
					<li>
						<div class="wrl">Web server : </div>
						<div class="wrr"><%=(domain.getWebserver()!=null)?domain.getWebserver():"-" %></div>
						<div class="cl"></div>
					</li>
					<li>
						<div class="wrl">Javascript : </div>
						<div class="wrr"><%=domain.getJsString().replaceAll("[ ]+[,]+[ ]+$","") %></div>
						<div class="cl"></div>
					</li>
					<li>
						<div class="wrl">IP Address : </div>
						<div class="wrr">
							<%
								if(domain.getIp() != null)
								{	
									String[] ips = domain.getIp().split("\n");
									for(int i=0;i<ips.length;i++)
									{			
							%>
										<a href="/ip/<%=ips[i] %>" title="Lookup Ip <%=ips[i] %>"><%=ips[i] %></a><br/>
							<%			
									}
								} else {
									out.println(domain.getName());
								}
							%>
						</div>
						<div class="cl"></div>
					</li>
					<li class="whr">Whois Record</li>
					<%
					if(whois.size()>0&&whois.get(0).getUser()!=null && !whois.get(0).getUser().equals(""))
					{
					%>
					<li>
						<div class="wrl">Owner : </div>
						<div class="wrr"><a href="/owner/<%=whois.get(0).getAliasUser()%>"><%=whois.get(0).getUser()%></a></div>
						<div class="cl"></div>
					</li>
					<%
					}
					%>
					
					<%
					if(whois.size()>0&&whois.get(0).getCreatedDate()!=null && !whois.get(0).getCreatedDate().equals(""))
					{
					%>
					<li>
						<div class="wrl">Created : </div>
						<div class="wrr"><a href="/created/<%=whois.get(0).getCreatedDate()%>"><%=whois.get(0).getCreatedDate()%></a></div>
						<div class="cl"></div>
					</li>	
					<%
					}
					%>
					<%
					if(whois.size()>0&&whois.get(0).getExpirationDate()!=null && !whois.get(0).getExpirationDate().equals(""))
					{
					%>
					<li>
						<div class="wrl">Expiration : </div>
						<div class="wrr"><a href="/expiration/<%=whois.get(0).getExpirationDate()%>"><%=whois.get(0).getExpirationDate()%></a></div>
						<div class="cl"></div>
					</li>	
					<%
					}
					%>
					<%
					if(whois.size()>0&&whois.get(0).getEmailString()!=null && !whois.get(0).getEmailString().equals(""))
					{
					%>
					<li>
						<div class="wrl">Email : </div>
						<div class="wrr"><%=whois.get(0).getEmailString() %></div>
						<div class="cl"></div>
					</li>	
					<%
					}
					%>
					<%
					if(whois.size()>0&&whois.get(0).getServerString()!=null && !whois.get(0).getServerString().equals(""))
					{
					%>
					<li>
						<div class="wrl">Server : </div>
						<div class="wrr"><%=whois.get(0).getServerString() %></div>
						<div class="cl"></div>
					</li>	
					<%
					}
					%>
				</ul>
				<%@ include file='/adv/right.jsp'%>
			</div>	
			<div class="cl"></div>
		</div>
		<script type="text/javascript"src="/js/jquery.js"></script>
		<script type="text/javascript"src="/js/re_detail.js"></script>
		<script type="text/javascript">
			var domain = '<%=domain.getName()%>';
		</script>
		<div id='opacity'></div>
<img src="/images/ajax-loader.gif" id='image_loadder'/>
<%@ include file='/layout/footer.jsp'%>